package com.css.zfzx.sjcj.modules.yhdisaster.repository.entity;

import java.util.Arrays;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * <p>住建类型-代表字符</p>
 *
 * 住建数据的类别extend1=(A-城镇，B-城非，C-农集，D-独立，E-农非，F-桥梁，G-水厂)
 *
 * @author liuhy
 * @date 2021/8/26
 */
public enum LiveToBuildEnums {

    CITY("城镇住宅", "A"),
    CITY_NON("城镇非住宅", "B"),
    VILLAGE_CEN("集合住宅", "C"),
    SEPARATE_HOUSE("独立住宅", "D"),
    VILLAGE_NON("农村非住宅", "E"),
    BRIDGE("桥梁", "F"),
    STATION("厂站", "G")
    ;

    private static final Map<String, String> map;

    static {
        map = Arrays.stream(values()).collect(Collectors.toMap(LiveToBuildEnums::getCode, LiveToBuildEnums::getName));
    }

    public static String getNameByCode(String code) {
        return map.get(code);
    }

    LiveToBuildEnums(String name, String code) {
        this.name = name;
        this.code = code;
    }

    private String name;
    private String code;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }
}
